type NameList = {
    name:string
}

export const axios = (url:string):Promise<NameList[]> => new Promise((reslove) => {
    let xhr:XMLHttpRequest = new XMLHttpRequest()

    xhr.open('GET', url)

    xhr.onreadystatechange = () => {
        if (xhr.readyState === 4 && xhr.status == 200) {
            let timer:any = setTimeout(() => {
                reslove(JSON.parse(xhr.responseText))
                clearTimeout(timer)
                timer = null
            }, 2000)
        }
    }

    xhr.send(null)
})